import request from '@/utils/request'

/**
 *   status        设备状态
 *   code          设备编号
 *   name:         设备名称
 *   type          设备型号
 *   original      设备原值
 *   btime:        采购时间
 *   cumulative    累计使用时长
 *   pic           设备图片
 *
 */
export const bookingAdd = data => {
    return request({
        url: '/booking/add',
        method: 'POST',
        data
    })
}


/**
 *  列出所有设备列表
 */
export const listBookingList = params => {
    return request({
        url: '/booking/list',
        method: 'GET',
        params
    })
}


/**
 *  根据状态列出预约情况
 */
export const listBookingListByStatus = status => {
    return request({
        url: `/booking/listByStatus/${status}`,
        method: 'GET'
    })
}


// export const listMyBookingList = data => {
//     return request({
//         url: '/booking/listUser',
//         method: 'POST',
//         data
//     })
// }

export const listMyBookingList = data => {
    return request({
        url: '/booking/listUser',
        method: 'POST',
        data
    })
}


/**
 * 删除
 * */

export const listHisByMid = data => {
    return request({
        url: '/booking/listHis',
        method: 'POST',
        data
    })
}


export const updateStatus = data => {
    return request({
        url: '/booking/pass',
        method: 'POST',
        data
    })
}


export const delBookingById = data => {
    return request({
        url: '/booking/del',
        method: 'POST',
        data
    })
}


//checkTimeRange
export const checkRange = data => {
    return request({
        url: '/booking/checkTimeRange',
        method: 'POST',
        data
    })
}
